#!/bin/bash

. `dirname $0`/../etc/controller.bash.inc
autoload_functions "box_mgt/valid_ip"

echo '[testing] valid_ip()'
ok_ip='192.168.5.40'
nok_ip='255.255.'
nok2_ip='255.255.255'
echo -n ' scenario 1 - '
[[ "$(valid_ip $ok_ip)" = "0" ]] && echo "OK" || echo "fail"
echo -n ' scenario 2 - '
[[ "$(valid_ip $nok_ip)" = "1" ]] && echo "OK" || echo "fail"
echo -n ' scenario 3 - '
[[ "$(valid_ip $nok2_ip)" = "1" ]] && echo "OK" || echo "fail"
